package com.qs.rocketmq.nacos.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping(value = "/provider")
@RestController
@RefreshScope  // 支持配置刷新
public class NacosProviderController {

    @Value("${nacos.myConfig}")
    private String myConfig;

    /**
     * 测试nacos作为配置中心功能
     * @since 2022-03-22 10:23:39
     */
    @GetMapping(value = "/getConfig/{id}")
    public String getConfig(@PathVariable("id") String id) {
        return myConfig;
    }
}
